package goover.unit06;

public class RunnableDemo05 {
    public static void main(String[] args){
        Thread t1 = new Thread(new Test02(),"t1");
        t1.start();
        for(int i = 0;i < 6;i++){
            System.out.println(Thread.currentThread().getName() + " - " + i);
            if(i == 4){
                try {
                    t1.join();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
class Test02 implements Runnable{
    @Override
    public void run() {
        for(int i = 0;i < 8;i++){
            System.out.println(Thread.currentThread().getName() + " - " + i);
        }
    }
}